<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    {include file="public/title" /}
    <meta name="keywords" content="HTML5 Bootstrap 3 Admin Template UI Theme">
    <meta name="description" content="Fusion - A Responsive HTML5 Admin UI Template Theme">
    <meta name="author" content="AdminDesigns">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    {include file="public/css" /}
    <style>
        .table a { color: blue;}
        dl, li { list-style:none;}
        .panel-body dt, .panel-body dd { float: left;}
        .clear {clear: both;}
        .panel-body dt { width: 7%;}
        .panel-body dd { width: 90%;}
        .panel-body dd li { float: left; min-width: 6%; padding: 0 10px;}
        .form-horizontal { padding-left: 30px;}
        .mix { display: block; border: 1px solid #d6d6d6; padding: 5px; text-align: center;}
    </style>
</head>
<body class="dashboard-page">

{include file="public/header" /}

<!-- Start: Main -->
<div id="main">

    <!-- Start: Sidebar -->
    <aside id="sidebar_left">
        <div class="sidebar-menu">
            <!--菜单-->
            {include file="public/menu1" /}
        </div>
    </aside>

    <!-- Start: Content -->
    <section id="content_wrapper">
        <div id="topbar">
            <div id="content">
                <div class="row">
                    <div class="col-md-6">
                        <div class="panel">
                            <div class="panel-heading"> <span class="panel-title">注册为CPS发布商</span> </div>
                            <div class="panel-body">
                                <form class="cmxform" id="form1" method="post" action="/index/login/to_bind_mobile" gotourl="/index">
                                    <div class="form-group">
                                        <input id="username" name="username" type="text" class="form-control" maxlength="20" placeholder="您的姓名" required="" />
                                    </div>
                                    <div class="form-group">
                                        <input id="mobile" name="mobile" type="number" class="form-control" maxlength="11" placeholder="手机号" required="" />
                                    </div>
                                    <div class="form-group">
                                        <input type="number" class="form-control" name="code" maxlength="4" autocomplete="off" placeholder="验证码" style="width: 50%; float: left;" />
                                        <input class="submit btn btn-alert pull-right" id="get_code" type="button" value="获取验证码" onclick="send(this)">
                                    </div>
                                    <div style="clear: both;"></div>
                                    <div class="form-group" style="margin-top: 20px;">
                                        <input class="submit btn btn-alert pull-right" type="button" value="注册" onclick="form_add()" />
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </section>

</div>
<!-- End #Main -->
{include file="public/js" /}
<script>
    var countdown = 60;
    function send(obj)
    {
        var mobile = $('#mobile').val();
        if (!checkMobile(mobile)) {
            layer.msg('请输入正确的手机号', {icon: 5});
            return;
        }
        layer.load();
        $.post('/index/login/send_code', {mobile:mobile}, function(data){
            layer.closeAll('loading');
            if (data.code != 1) {
                layer.msg(data.msg, {icon: 5});
                return;
            }
            settime(obj);
        });
    }
    function settime(obj)
    {
        $(obj).removeClass('btn-alert');
        if (countdown == 0) {
            obj.removeAttribute("disabled");
            obj.value="获取验证码";
            countdown = 60;
            $(obj).addClass('btn-alert');
            return;
        } else {
            obj.setAttribute("disabled", true);
            obj.value="重新发送(" + countdown + ")s";
            countdown--;
        }
        setTimeout(function() {
            settime(obj);
        } ,1000)
    }
    function checkMobile(s)
    {
        var length = s.length;
        if(length == 11 && /^1[3|4|5|7|8][0-9]{9}$/.test(s) )
        {
            return true;
        }else{
            return false;
        }
    }
</script>
</body>
</html>
